package com.thunisoft.intranet.order.dao.impl;

import java.util.List;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;

import com.thunisoft.intranet.domain.TOrder;
import com.thunisoft.intranet.order.dao.IOrderDAO;

public class OrderDAOImpl implements IOrderDAO {
	
    @Autowired
	private SessionFactory sessionFactory;
	
	@Override
	public void saveOrderInfo(TOrder order) {
		 sessionFactory.openSession().save(order);
	}

	@Override
	public List<TOrder> getOrderList() {
		String hql = "from TOrder";

		Session sess = sessionFactory.openSession();
		@SuppressWarnings("unchecked")
		List<TOrder> list = sess.createQuery(hql).list();
		return list;
	}
	
}
